﻿using System;

namespace EaseDapper.Utilities
{
    internal static class ValidateExtensions
    {
        public static Type StringType = typeof(string);

        public static bool IsClass(this Type thisValue)
        {
            return thisValue != StringType && thisValue.IsEntity();
        }

        public static bool IsEntity(this Type type)
        {
            return type.IsClass;
        }

        public static bool IsEnum(this Type type)
        {
            return type.IsEnum;
        }

        public static bool IsString(this Type type)
        {
            return type.BaseType.Equals(StringType);
        }

        public static bool IsBool(this Type type)
        {
            return type.Equals(typeof(bool));
        }

        public static bool IsDateTime(this Type type)
        {
            return type.Equals(typeof(DateTime));
        }

        public static bool NotNull(this string str)
        {
            return !string.IsNullOrWhiteSpace(str);
        }

        public static bool NotNull(this object obj)
        {
            return obj != null;
        }
    }
}
